package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.entity.SysMsg;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.service.ISysMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/system/msg")
public class SysMsgController extends BaseController {

    // 注入ISysMsgService
    @Autowired
    private ISysMsgService msgService;

    /**
     * 获取消息列表
     */
    //@PreAuthorize这个注解是用来进行权限判断的
    //该注解由SpringSecurity提供用于在方法执行前进行权限验证
    @PreAuthorize("@ss.hasPermi('system:user:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysMsg msg) {
        startPage();
        List<SysMsg> list = msgService.selectMsgList(msg);
        return getDataTable(list);
    }
}
